import dayjs from "dayjs";

export const getImageUrl = (url: string) => {
    return import.meta.env.VITE_API_BASE_URL + '/file/downloadImage?url=' + encodeURIComponent(url)
}

export const checkDateExpire = (date: string | null, interval: number = 30, formate: string = "YYYY-MM-DD") => {

    if (date === null || date.length < 10) {
        return false
    }
    // 检查date和当前间隔天数是否小于interval
    return dayjs().isAfter(dayjs(date, formate).add(interval, 'day'))
}
